package com.caosong.raptor.blog.article.service;

import com.caosong.raptor.blog.article.proto.HelloReply;
import com.caosong.raptor.blog.article.proto.HelloRequest;
import com.caosong.raptor.blog.article.proto.HelloRpcService;
import org.apache.dubbo.config.annotation.DubboService;
import org.springframework.stereotype.Service;

import java.util.concurrent.CompletableFuture;

@DubboService(version = "1.0.0")
@Service
public class HelloServiceRpcImpl implements HelloRpcService {
    @Override
    public HelloReply helloService(HelloRequest request) {
        String name = request.getName();
        HelloReply.Builder helloReplyBuilder = HelloReply.newBuilder();
        return helloReplyBuilder.setMessage("hello:"+name).build();
    }

    @Override
    public CompletableFuture<HelloReply> helloServiceAsync(HelloRequest request) {
        return HelloRpcService.super.helloServiceAsync(request);
    }
}
